/*
    Created by Zheng Hao on 2024/3/22.
*/


#include "zmtp_classes.h"

void zmtp_connect_test(const char* ip_addr)
{
    printf(" * zmtp_connect_test: ");
    zmtp_dealer_t *dealer = zmtp_dealer_new();

    printf("The argument is %s\n", ip_addr);
    int iRet = zmtp_dealer_listen(dealer, (const char *)ip_addr, NULL);
    if (iRet != 0) {
        printf("fail, zmtp_dealer_listen: %d\n", iRet);
        return;
    }
    
    printf("Now recving...(zmtp_dealer_recv)\n");
    zmtp_msg_t *msg = zmtp_dealer_recv(dealer);
    byte *bytes = zmtp_msg_data(msg);
    printf("%p\n", (char*)bytes);

    printf("Now sending...(zmtp_dealer_send)\n");
    zmtp_dealer_send(dealer, msg);
    // @end
    printf("OK\n");
}